from pydantic import BaseModel
from typing import Any


class UnifiedResponse(BaseModel):
    code: int = 200
    message: str = "Success"
    data: Any = None

    @classmethod
    def success(cls, data: Any = None, message: str = "Success"):
        return cls(code=200, message=message, data=data)

    @classmethod
    def error(cls, code: int, message: str):
        return cls(code=code, message=message, data=None)
